﻿@model IEnumerable<DietPlanning.Models.Food>

@{
    ViewBag.Title = "FoodPage";
    Layout = "~/Views/Shared/_LayoutUser.cshtml";
}

    <fieldset>
        <div class="editor-label">
            @Html.Label("Tên nguyên liệu")
        </div>
        <div class="editor-field;left">
            @Html.TextBox("txtFoodName");
        </div>
        <p>
            <input type="submit" value="Tìm kiếm" />
        </p>
    </fieldset>
<h3>
    Các thực phẩm phổ biến</h3>
<table>
    @{
        var favoriteFood = Model.OrderByDescending(o => o.Popular).Take(10).ToList();
        for (int i = 0; i < favoriteFood.Count(); i++)
        {
            DietPlanning.Models.Food item = favoriteFood.ElementAt(i);
            if (i % 5 == 0)
            {
        <tr>
        </tr>
        <td>
            <div>
                <img src="/Images/Food/@item.ImageURL/"  alt="" height="160px" width="200px" />
                <br />
                @Html.DisplayFor(modelItem => item.FoodName)
                <br />
            </div>
        </td>

            }
            else
            {
        <td>
            <div>
                <img src="/Images/Food/@item.ImageURL/"  alt="" height="160px" width="200px"  />
                <br />
                @Html.DisplayFor(modelItem => item.FoodName)
                <br />
            </div>
        </td>
            }

        }
    }
</table>
